home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / qex / qexhfm / modem.dsp < prev    next >
Text File  |  1994-10-27  |  45KB  |  1,063 lines

  1. {----------------------------------------------------------------------------}
  2. {            PSA HF modem software for the Nov 1994 QEX article                 }
  3. {             "An Adaptive HF DSP Modem for 100 and 200 Baud"                }
  4. {                 (c) 1994, Johan Forrer, KC7WW                              }
  5. {               26553 Priceview Drive                     }
  6. {                      Monroe, OR 97456                                 }
  7. {                                                    }
  8. {----------------------------------------------------------------------------}
  9. {                                         }
  10. {                        Assembly instructions:                   }
  11. {                                                                    }
  12. {                         >SpAsm21 modem.dsp                     }
  13. {                                         }
  14. {----------------------------------------------------------------------------}
  15. {                                         }
  16. {                   Some useful PSA hardware addresses                 }
  17. {                                         }
  18. {----------------------------------------------------------------------------}
  19.  
  20. .const PSS_data_reg    =0x3000;
  21. .const PSS_control_reg    =0x3008;
  22. .const PSS_status_reg    =0x3008;
  23. .const PSS_dma_reg    =0x3010;
  24. .const ram_bank_reg    =0x3018;
  25. .const ext_mem_latch    =0x3020;
  26. .const PSS_PIO_reg    =0x31C8;
  27.  
  28. .const addr_1848    =0x3440;
  29. .const data_1848    =0x3448;
  30. .const stat_1848    =0x3450;
  31. .const pio_1848        =0x3458;
  32. .const IRQ_status    =0x31C0;
  33. .const dmal_1848    =0x3060;
  34. .const dmar_1848    =0x3068;
  35. .const enable_1848    =0x3070;
  36.  
  37. .const system_control    =0x3FFF;
  38. .const wait_state_ctl    =0x3FFE;
  39. .const timer_period    =0x3FFD;
  40. .const timer_counter    =0x3FFC;
  41. .const timer_prescale    =0x3FFB;
  42.  
  43. {----------------------------------------------------------------------------}
  44. {                                         }
  45. {                     User's application storage                     }
  46. {                                         }
  47. {----------------------------------------------------------------------------}
  48.  
  49. .const bpf_out        =0x3800;        { Input BPF output           }
  50. .const data_out        =0x3801;          { Data  LPF output           }
  51. .const mark_out        =0x3802;        { Mark  BPF output           }
  52. .const space_out    =0x3803;        { Space BPF output           }
  53.  
  54. .const mps         =0x3804;        { sine's sign              }
  55. .const tph        =0x3805;        { phase accumulator          }
  56. .const wkph        =0x3806;        { phase accumulator (temp)   }
  57. .const sinx        =0x3807;        { result of table lookup     }
  58. .const sigout        =0x3808;        { D/A value for output       }
  59. .const databit        =0x3809;        { Tone generator state       } 
  60. .const timing_val    =0x380A;        { Timer constant             }
  61. .const dither        =0x380B;        { use timer dither or not    }
  62. .const modem_select     =0x380C;        { select 100/200 modem       }
  63.  
  64. {----------------------------------------------------------------------------}
  65. {                                         }
  66. {                     User's circular buffer storage                     }
  67. {                                         }
  68. {----------------------------------------------------------------------------}
  69. {                       9- 16 requires a " 16=0x0010" boundary               }
  70. {               length 17- 32 requires a " 32=0x0020" boundary               }
  71. {                      33- 64 requires a " 64=0x0040" boundary               }
  72. {                      65-128 requires a "128=0x0080" boundary               }
  73. {----------------------------------------------------------------------------}
  74.  
  75. .const DATALP        =0x3820;    { 3820 -> 383F Data low pass         }
  76. .const FILTER        =0x3840;    { 3880 -> 38CF Filter delay line     } 
  77. .const BPFI        =0x3920;    { 3920 -> 393F Input bandpass          }
  78.  
  79.  
  80. {=================  USER DSP APPLICATION CODE  ==============================}
  81. {------------------ Interrupt service routine -------------------------------}
  82. 0x0100  sound_prt:
  83.     ena sec_reg;            { use alternate registers            }
  84.     
  85. { The way we have the audio jack connected, only the left channel will       }
  86. { carry a signal. Input data is save in a circular buffer.                   }
  87.  
  88.     ax1=dm(sigout);            { pick up AFSK out/input signal      }
  89.     dm(dmal_1848)=ax1;
  90.     dm(dmar_1848)=ax1;        { this also resets interrupt         }
  91.  
  92.     ar=dm(dmal_1848);        { using only left input channel      }
  93.     dm(i1,m1)=ar;
  94.     ar=dm(dmar_1848);        { read right input but discard it    }
  95.  
  96. {------------------ Check which modem is in effect --------------------------}
  97.  
  98.     ax0=dm(modem_select);
  99.     ay0=0x0000;            { 0000 ==> 100 baud                  }
  100.     ar=ax0 xor ay0;
  101.     if eq jump filt100;
  102.  
  103. {------------------- 200 baud modem -----------------------------------------}
  104.     call bpf_in2;            { do input bandpass                  }
  105.     ar=dm(bpf_out);
  106.     dm(i2,m1)=ar;
  107.  
  108.     call mark_filter2;        { do 200 baud mark                   }
  109.     call space_filter2;        { do 200 baud space                  }
  110.  
  111.     ax0=dm(mark_out);        { subtract channels                  }
  112.     ay0=dm(space_out);
  113.     ar=ax0 - ay0;
  114.     dm(i3,m1)=ar;
  115.     call data_lp2;            { do 200 baud data low pass          }
  116.     jump modulate;
  117.  
  118. {------------------- 100 baud modem -----------------------------------------}
  119. filt100:                         
  120.     call bpf_in1;            { do input bandpass                  }
  121.     ar=dm(bpf_out);
  122.     dm(i2,m1)=ar;
  123.  
  124.     call mark_filter1;        { do 100 baud mark                   }
  125.     call space_filter1;        { do 100 baud space                  }
  126.  
  127.     ax0=dm(mark_out);        { subtract channels                  }
  128.     ay0=dm(space_out);
  129.     ar=ax0 - ay0;
  130.     dm(i3,m1)=ar;
  131.     call data_lp1;            { do 100 baud data low pass          }
  132.  
  133. {-------------- Check whether AFSK is needed --------------------------------}
  134. modulate:    
  135.     ax0=dm(databit);
  136.     ay0=0x0000;            { 0000 ==> no AFSK                   }
  137.     ar=ax0 xor ay0;
  138.     if eq jump no_afsk;
  139.  
  140.     call afsk;            { do AFSK synthesis                  }
  141.                     { NOTE: output is scaled >> 4        }
  142.     jump rti_exit;
  143. no_afsk:
  144.     ar=dm(bpf_out);
  145.     dm(sigout)=ar;
  146.     dm(tph)=ay0;            { zero out the phase initially       }
  147.  
  148. rti_exit:
  149.     dis sec_reg;            { restore normal registers           }
  150.     rti;
  151.  
  152. {----------------------------------------------------------------------------}
  153. {              Input bandpass filter for 200 baud                       }
  154. {                         Fs=5512.5                                          }
  155. {               Fcl=2030, Fch=2390     (BWpb=360)                     }
  156. {              Fstl=1805,  Fsth=2615   (BWsb=810)                    }
  157. {                                         }
  158. {              FINITE IMPULSE RESPONSE (FIR)                     }                         
  159. {            LINEAR PHASE DIGITAL FILTER DESIGN                     }                         
  160. {                REMEZ EXCHANGE ALGORITHM                                 }
  161. {                                                                         }
  162. {             FILTER LENGTH =  32, delay = 2.9ms                         }                
  163. {                                                                         }
  164. {              ***** IMPULSE RESPONSE *****                                 }
  165. {         H( 1) =    -278.439 = H( 32)                              }
  166. {         H( 2) =    -149.066 = H( 31)                              }
  167. {         H( 3) =     157.169 = H( 30)                              }
  168. {         H( 4) =     -54.794 = H( 29)                              }
  169. {         H( 5) =    -115.210 = H( 28)                              }
  170. {         H( 6) =     103.357 = H( 27)                              }
  171. {         H( 7) =     373.048 = H( 26)                              }
  172. {         H( 8) =   -1314.999 = H( 25)                              }
  173. {         H( 9) =    2242.769 = H( 24)                              }
  174. {         H(10) =   -2358.994 = H( 23)                              }
  175. {         H(11) =    1064.553 = H( 22)                              }
  176. {         H(12) =    1491.543 = H( 21)                              }
  177. {         H(13) =   -4262.201 = H( 20)                              }
  178. {         H(14) =    5769.721 = H( 19)                              }
  179. {         H(15) =   -4966.988 = H( 18)                              }
  180. {         H(16) =    1957.288 = H( 17)                              }
  181. {                                                              }
  182. {                       BAND  1       BAND  2       BAND  3              }
  183. { LOWER BAND EDGE      .0000000      .3682540      .4743760              }
  184. { UPPER BAND EDGE      .3274376      .4335600      .5000000              }
  185. { DESIRED VALUE        .0000000     1.0000000      .0000000              }
  186. { WEIGHTING          10.0000000     1.0000000    10.0000000              }
  187. { DEVIATION            .0208284      .2082838      .0208284              }
  188. { DEVIATION IN DB   -33.6268900     1.6433790   -33.6268900              }
  189. {----------------------------------------------------------------------------}
  190. dc:  0xFEEA00; { -278.438995 }
  191.      0xFF6B00; { -149.065994 }
  192.      0x009D00; {  157.169006 }
  193.      0xFFC900; {  -54.793999 }
  194.      0xFF8D00; { -115.209999 }
  195.      0x006700; {  103.357002 }
  196.      0x017500; {  373.048004 }
  197.      0xFADD00; {-1314.999023 }
  198.      0x08C300; { 2242.769043 }
  199.      0xF6C900; {-2358.993896 }
  200.      0x042900; { 1064.552979 }
  201.      0x05D400; { 1491.542969 }
  202.      0xEF5A00; {-4262.201172 }
  203.      0x168A00; { 5769.721191 }
  204.      0xEC9900; {-4966.987793 }
  205.      0x07A500; { 1957.287964 }
  206.      0x07A500; { 1957.287964 }
  207.      0xEC9900; {-4966.987793 }
  208.      0x168A00; { 5769.721191 }
  209.      0xEF5A00; {-4262.201172 }
  210.      0x05D400; { 1491.542969 }
  211.      0x042900; { 1064.552979 }
  212.      0xF6C900; {-2358.993896 }
  213.      0x08C300; { 2242.769043 }
  214.      0xFADD00; {-1314.999023 }
  215.      0x017500; {  373.048004 }
  216.      0x006700; {  103.357002 }
  217.      0xFF8D00; { -115.209999 }
  218.      0xFFC900; {  -54.793999 }
  219.      0x009D00; {  157.169006 }
  220.      0xFF6B00; { -149.065994 }
  221.      0xFEEA00; { -278.438995 }
  222. {----------------------------------------------------------------------------}
  223. bpf_in2:      
  224.     i4=dc;                { point to coefficients              }
  225.     mr=0, mx0=dm(i1,m1), my0=pm(i4,m5);
  226.     cntr=31;            { length - 1                         }
  227.     do sopbp until ce;
  228. sopbp:    mr=mr+mx0*my0(ss), mx0=dm(i1,m1), my0=pm(i4,m5);
  229.     mr=mr+mx0*my0(rnd);
  230.     if mv sat mr;
  231.     dm(bpf_out)=mr1;        { save input BPF result              }
  232.     rts;
  233.  
  234. {----------------------------------------------------------------------------}
  235. {             2110 Hz Mark bandpass filter for 200 baud                      } 
  236. {                         Fs=5512.5                                          }
  237. {               Fcl=2030, Fch=2190     (BWpb=160)                     }
  238. {              Fstl=1805,  Fsth=2415   (BWsb=610)                    }
  239. {                                          }
  240. {              FINITE IMPULSE RESPONSE (FIR)                     }
  241. {            LINEAR PHASE DIGITAL FILTER DESIGN                     }
  242. {                REMEZ EXCHANGE ALGORITHM                     }
  243. {                                         }
  244. {                     BANDPASS FILTER                         }
  245. {                                         }
  246. {             FILTER LENGTH =  32, delay = 2.9ms                 }
  247. {                                         }
  248. {              ***** IMPULSE RESPONSE *****                     }
  249. {         H( 1) =     325.335 = H( 32)                         }
  250. {         H( 2) =    -420.936 = H( 31)                         }
  251. {         H( 3) =     354.788 = H( 30)                         }
  252. {         H( 4) =     205.330 = H( 29)                         }
  253. {         H( 5) =   -1001.936 = H( 28)                         }
  254. {         H( 6) =    1462.444 = H( 27)                         }
  255. {         H( 7) =   -1159.848 = H( 26)                         }
  256. {         H( 8) =     -20.884 = H( 25)                         }
  257. {         H( 9) =    1661.597 = H( 24)                         }
  258. {         H(10) =   -2765.895 = H( 23)                         }
  259. {         H(11) =    2415.138 = H( 22)                         }
  260. {         H(12) =    -555.952 = H( 21)                         }
  261. {         H(13) =   -1903.418 = H( 20)                         }
  262. {         H(14) =    3603.038 = H( 19)                         }
  263. {         H(15) =   -3471.036 = H( 18)                         }
  264. {         H(16) =    1428.150 = H( 17)                         }
  265. {                                         }
  266. {                       BAND  1       BAND  2       BAND  3             }
  267. { LOWER BAND EDGE      .0000000      .3682540      .4380950             }
  268. { UPPER BAND EDGE      .3274376      .3972789      .5000000             }
  269. { DESIRED VALUE        .0000000     1.0000000      .0000000             }
  270. { WEIGHTING          10.0000000     1.0000000    10.0000000             }
  271. { DEVIATION            .0095166      .0951655      .0095166             }
  272. { DEVIATION IN DB   -40.4304100      .7895952   -40.4304100             }
  273. {----------------------------------------------------------------------------}
  274. hc:  0x014500; {  325.334991 } 
  275.      0xFE5B00; { -420.936005 } 
  276.      0x016300; {  354.787994 } 
  277.      0x00CD00; {  205.330002 } 
  278.      0xFC1600; {-1001.935974 } 
  279.      0x05B600; { 1462.443970 } 
  280.      0xFB7800; {-1159.848022 } 
  281.      0xFFEB00; {  -20.884001 } 
  282.      0x067E00; { 1661.597046 } 
  283.      0xF53200; {-2765.895020 } 
  284.      0x096F00; { 2415.137939 } 
  285.      0xFDD400; { -555.952026 } 
  286.      0xF89100; {-1903.417969 } 
  287.      0x0E1300; { 3603.038086 } 
  288.      0xF27100; {-3471.035889 } 
  289.      0x059400; { 1428.150024 } 
  290.      0x059400; { 1428.150024 } 
  291.      0xF27100; {-3471.035889 } 
  292.      0x0E1300; { 3603.038086 } 
  293.      0xF89100; {-1903.417969 } 
  294.      0xFDD400; { -555.952026 } 
  295.      0x096F00; { 2415.137939 } 
  296.      0xF53200; {-2765.895020 } 
  297.      0x067E00; { 1661.597046 } 
  298.      0xFFEB00; {  -20.884001 } 
  299.      0xFB7800; {-1159.848022 } 
  300.      0x05B600; { 1462.443970 } 
  301.      0xFC1600; {-1001.935974 }
  302.      0x00CD00; {  205.330002 }
  303.      0x016300; {  354.787994 }
  304.      0xFE5B00; { -420.936005 }
  305.      0x014500; {  325.334991 }
  306. {----------------------------------------------------------------------------}
  307. mark_filter2:                                     
  308.     i4=hc;                { point to coefficients              }         
  309.     l2=32;                { This filter length                 }
  310.     mr=0, mx0=dm(i2,m1), my0=pm(i4,m5);                     
  311.     cntr=31;            { length - 1                         }                 
  312.     do sopm until ce;                             
  313. sopm:    mr=mr+mx0*my0(ss), mx0=dm(i2,m1), my0=pm(i4,m5);             
  314.     mr=mr+mx0*my0(rnd);                             
  315.     if mv sat mr;
  316.     ar = abs mr1;            { envelope detection                 }
  317.     dm(mark_out)=ar;        { save mark result                   }             
  318.     rts;                                     
  319.  
  320. {----------------------------------------------------------------------------}
  321. {             2310 Hz Mark bandpass filter for 200 baud                      } 
  322. {                         Fs=5512.5                                          }
  323. {               Fcl=2230,   Fch=2390   (BWpb=160)                     }
  324. {              Fstl=2005,  Fsth=2615   (BWsb=610)                    }
  325. {                                          }
  326. {              FINITE IMPULSE RESPONSE (FIR)                     }
  327. {            LINEAR PHASE DIGITAL FILTER DESIGN                     }
  328. {                REMEZ EXCHANGE ALGORITHM                     }
  329. {                                         }
  330. {                     BANDPASS FILTER                         }
  331. {                                         }
  332. {             FILTER LENGTH =  32, delay = 2.9ms                 }
  333. {                                         }
  334. {              ***** IMPULSE RESPONSE *****                     }
  335. {         H( 1) =    -397.911 = H( 32)                         }
  336. {         H( 2) =     461.562 = H( 31)                         }
  337. {         H( 3) =    -461.312 = H( 30)                         }
  338. {         H( 4) =     187.683 = H( 29)                         }
  339. {         H( 5) =     381.682 = H( 28)                         }
  340. {         H( 6) =   -1125.509 = H( 27)                         }
  341. {         H( 7) =    1787.245 = H( 26)                         }
  342. {         H( 8) =   -2051.599 = H( 25)                         }
  343. {         H( 9) =    1673.964 = H( 24)                         }
  344. {         H(10) =    -608.627 = H( 23)                         }
  345. {         H(11) =    -926.055 = H( 22)                         }
  346. {         H(12) =    2486.161 = H( 21)                         }
  347. {         H(13) =   -3543.459 = H( 20)                         }
  348. {         H(14) =    3681.655 = H( 19)                         }
  349. {         H(15) =   -2768.423 = H( 18)                         }
  350. {         H(16) =    1027.235 = H( 17)                         }
  351. {                                         }
  352. {                       BAND  1       BAND  2       BAND  3             }
  353. { LOWER BAND EDGE      .0000000      .4045350      .4743760             }
  354. { UPPER BAND EDGE      .3637188      .4335600      .5000000             }
  355. { DESIRED VALUE        .0000000     1.0000000      .0000000             }
  356. { WEIGHTING          10.0000000     1.0000000    10.0000000             }
  357. { DEVIATION            .0119457      .1194566      .0119457             }
  358. { DEVIATION IN DB   -38.4558000      .9801453   -38.4558000             }
  359. {----------------------------------------------------------------------------}
  360. jc:  0xFE7200; { -397.911011 } 
  361.      0x01CE00; {  461.562012 } 
  362.      0xFE3300; { -461.312012 } 
  363.      0x00BC00; {  187.682999 } 
  364.      0x017E00; {  381.682007 } 
  365.      0xFB9A00; {-1125.509033 } 
  366.      0x06FB00; { 1787.244995 } 
  367.      0xF7FC00; {-2051.599121 } 
  368.      0x068A00; { 1673.963989 } 
  369.      0xFD9F00; { -608.627014 } 
  370.      0xFC6200; { -926.054993 } 
  371.      0x09B600; { 2486.160889 } 
  372.      0xF22900; {-3543.458984 } 
  373.      0x0E6200; { 3681.655029 } 
  374.      0xF53000; {-2768.423096 } 
  375.      0x040300; { 1027.234985 } 
  376.      0x040300; { 1027.234985 } 
  377.      0xF53000; {-2768.423096 } 
  378.      0x0E6200; { 3681.655029 } 
  379.      0xF22900; {-3543.458984 } 
  380.      0x09B600; { 2486.160889 } 
  381.      0xFC6200; { -926.054993 } 
  382.      0xFD9F00; { -608.627014 } 
  383.      0x068A00; { 1673.963989 } 
  384.      0xF7FC00; {-2051.599121 } 
  385.      0x06FB00; { 1787.244995 } 
  386.      0xFB9A00; {-1125.509033 } 
  387.      0x017E00; {  381.682007 }
  388.      0x00BC00; {  187.682999 }
  389.      0xFE3300; { -461.312012 }
  390.      0x01CE00; {  461.562012 }
  391.      0xFE7200; { -397.911011 }
  392. {----------------------------------------------------------------------------}
  393. space_filter2:                                     
  394.     i4=jc;                { point to coefficients              }         
  395.     l2=32;                { filter length                      }
  396.     mr=0, mx0=dm(i2,m1), my0=pm(i4,m5);                     
  397.     cntr=31;            { length - 1                         }                 
  398.     do sops until ce;                             
  399. sops:    mr=mr+mx0*my0(ss), mx0=dm(i2,m1), my0=pm(i4,m5);             
  400.     mr=mr+mx0*my0(rnd);                             
  401.     if mv sat mr;
  402.     ar = abs mr1;            { envelope detection                 }
  403.     dm(space_out)=ar;        { save space result                  }             
  404.     rts;                                     
  405.  
  406. {----------------------------------------------------------------------------}
  407. {              Data output lowpass filter                         }
  408. {----------------------------------------------------------------------------}
  409. { Type of filter is LOW PASS FILTER                         }
  410. { Filter length is 31 samples                             }
  411. { Sampling frequency is     5512.500 Hz                         }
  412. { Filter cut-off frequency is      200.000 Hz                     }
  413. { Type of window function is KAISER-BESSEL WINDOW                 }
  414. { Attenuation parameter of window is 60.000 dB                     }
  415. { Coefficient word length is 16 bits                         }
  416. {                                         }
  417. { Filter coefficients:                                 }
  418. {                                         }
  419. {   i          h[i]        hqf[i]        hqi[i]                          }
  420. {                                                                     }
  421. {   0   -0.00011866   -0.00012207            -4                          }
  422. {   1   -0.00005377   -0.00006104            -2                          }
  423. {   2    0.00037365    0.00036621            12                          }
  424. {   3    0.00143962    0.00143433            47                          }
  425. {   4    0.00345224    0.00344849           113                          }
  426. {   5    0.00670193    0.00671387           220                          }
  427. {   6    0.01140058    0.01141357           374                          }
  428. {   7    0.01762031    0.01760864           577                          }
  429. {   8    0.02524469    0.02523804           827                          }
  430. {   9    0.03394446    0.03393555          1112                          }
  431. {  10    0.04318654    0.04318237          1415                          }
  432. {  11    0.05227925    0.05227661          1713                          }
  433. {  12    0.06044954    0.06045532          1981                          }
  434. {  13    0.06694148    0.06695557          2194                          }
  435. {  14    0.07112005    0.07110596          2330                          }
  436. {  15    0.07256236    0.07257080          2378                          }
  437. {  16    0.07112005    0.07110596          2330                          }
  438. {  17    0.06694148    0.06695557          2194                          }
  439. {  18    0.06044954    0.06045532          1981                          }
  440. {  19    0.05227925    0.05227661          1713                          }
  441. {  20    0.04318654    0.04318237          1415                          }
  442. {  21    0.03394446    0.03393555          1112                          }
  443. {  22    0.02524469    0.02523804           827                          }
  444. {  23    0.01762031    0.01760864           577                          }
  445. {  24    0.01140058    0.01141357           374                          }
  446. {  25    0.00670193    0.00671387           220                          }
  447. {  26    0.00345224    0.00344849           113                          }
  448. {  27    0.00143962    0.00143433            47                          }
  449. {  28    0.00037365    0.00036621            12                          }
  450. {  29   -0.00005377   -0.00006104            -2                          }
  451. {  30   -0.00011866   -0.00012207            -4                          }
  452. {----------------------------------------------------------------------------}
  453. kc:    0xFFFC00; {   -4.000000 }                     
  454.     0xFFFE00; {   -2.000000 }                     
  455.     0x000C00; {   12.000000 }                     
  456.     0x002F00; {   47.000000 }                     
  457.     0x007100; {  113.000000 }
  458.     0x00DC00; {  220.000000 }
  459.     0x017600; {  374.000000 }
  460.     0x024100; {  577.000000 }
  461.     0x033B00; {  827.000000 }
  462.     0x045800; { 1112.000000 }
  463.     0x058700; { 1415.000000 }
  464.     0x06B100; { 1713.000000 }
  465.     0x07BD00; { 1981.000000 }
  466.     0x089200; { 2194.000000 }
  467.     0x091A00; { 2330.000000 }
  468.     0x094A00; { 2378.000000 }
  469.     0x091A00; { 2330.000000 }
  470.     0x089200; { 2194.000000 }
  471.     0x07BD00; { 1981.000000 }
  472.     0x06B100; { 1713.000000 }
  473.     0x058700; { 1415.000000 }
  474.     0x045800; { 1112.000000 }
  475.     0x033B00; {  827.000000 }
  476.     0x024100; {  577.000000 }
  477.     0x017600; {  374.000000 }
  478.     0x00DC00; {  220.000000 }
  479.     0x007100; {  113.000000 }
  480.     0x002F00; {   47.000000 }
  481.     0x000C00; {   12.000000 }
  482.     0xFFFE00; {   -2.000000 }
  483.     0xFFFC00; {   -4.000000 }
  484. {----------------------------------------------------------------------------}
  485. data_lp2:      
  486.     i4=kc;                { point to coefficients              }
  487.     l3=31;                { filter length                      }
  488.     mr=0, mx0=dm(i3,m1), my0=pm(i4,m5);
  489.     cntr=30;            { length - 1                         }
  490.     do sopd2 until ce;
  491. sopd2:    mr=mr+mx0*my0(ss), mx0=dm(i3,m1), my0=pm(i4,m5);
  492.     mr=mr+mx0*my0(rnd);
  493.     if mv sat mr;
  494.     dm(data_out)=mr1;        { save result                        }
  495.     rts;
  496. {----------------------------------------------------------------------------}
  497. {            Input bandpass filter for 100 baud                     }
  498. {                       Fs=5512.5                                            }
  499. {              Fcl=2075,   Fch=2345  (BWpb=270)                             }
  500. {            Fstpl=1850, Fstph=2570  (BWsb=720)                         }
  501. {                                         }
  502. {              FINITE IMPULSE RESPONSE (FIR)                     }
  503. {            LINEAR PHASE DIGITAL FILTER DESIGN                     }
  504. {                REMEZ EXCHANGE ALGORITHM                     }
  505. {                                         }
  506. {                     BANDPASS FILTER                         }
  507. {                                         }
  508. {            FILTER LENGTH =  32, delay = 2.9ms                     }
  509. {                                         }
  510. {              ***** IMPULSE RESPONSE *****                     }
  511. {         H( 1) =    -187.176 = H( 32)                              }
  512. {         H( 2) =     -97.714 = H( 31)                              }
  513. {         H( 3) =    -170.816 = H( 30)                              }
  514. {         H( 4) =     446.096 = H( 29)                              }
  515. {         H( 5) =    -556.451 = H( 28)                              }
  516. {         H( 6) =     260.679 = H( 27)                              }
  517. {         H( 7) =     556.888 = H( 26)                              }
  518. {         H( 8) =   -1673.540 = H( 25)                              }
  519. {         H( 9) =    2514.301 = H( 24)                              }
  520. {         H(10) =   -2408.182 = H( 23)                              }
  521. {         H(11) =    1018.579 = H( 22)                              }
  522. {         H(12) =    1327.451 = H( 21)                              }
  523. {         H(13) =   -3664.771 = H( 20)                              }
  524. {         H(14) =    4826.718 = H( 19)                              }
  525. {         H(15) =   -4082.166 = H( 18)                              }
  526. {         H(16) =    1594.695 = H( 17)                              }
  527. {                                                                         }
  528. {                       BAND  1       BAND  2       BAND  3                  }
  529. { LOWER BAND EDGE      .0000000      .3764000      .4662000                  }
  530. { UPPER BAND EDGE      .3356000      .4254000      .5000000                  }
  531. { DESIRED VALUE        .0000000     1.0000000      .0000000                  }
  532. { WEIGHTING          10.0000000     1.0000000    10.0000000                  }
  533. { DEVIATION            .0180309      .1803087      .0180309                  }
  534. { DEVIATION IN DB   -34.8796700     1.4399120   -34.8796700                  }
  535. {----------------------------------------------------------------------------}
  536. dc1:   0xFF4500; { -187.175995 }    
  537.        0xFF9E00; {  -97.713997 }    
  538.        0xFF5500; { -170.815994 }    
  539.        0x01BE00; {  446.096008 }    
  540.        0xFDD400; { -556.450989 }    
  541.        0x010500; {  260.678986 }    
  542.        0x022D00; {  556.888000 }    
  543.        0xF97600; {-1673.540039 }    
  544.        0x09D200; { 2514.301025 }    
  545.        0xF69800; {-2408.181885 }    
  546.        0x03FB00; { 1018.578979 }    
  547.        0x052F00; { 1327.451050 }    
  548.        0xF1AF00; {-3664.770996 }    
  549.        0x12DB00; { 4826.717773 }    
  550.        0xF00E00; {-4082.166016 }    
  551.        0x063B00; { 1594.694946 }    
  552.        0x063B00; { 1594.694946 }    
  553.        0xF00E00; {-4082.166016 }    
  554.        0x12DB00; { 4826.717773 }    
  555.        0xF1AF00; {-3664.770996 }    
  556.        0x052F00; { 1327.451050 }    
  557.        0x03FB00; { 1018.578979 }    
  558.        0xF69800; {-2408.181885 }
  559.        0x09D200; { 2514.301025 }
  560.        0xF97600; {-1673.540039 }
  561.        0x022D00; {  556.888000 }
  562.        0x010500; {  260.678986 }
  563.        0xFDD400; { -556.450989 }
  564.        0x01BE00; {  446.096008 }
  565.        0xFF5500; { -170.815994 }
  566.        0xFF9E00; {  -97.713997 }
  567.        0xFF4500; { -187.175995 }
  568. {----------------------------------------------------------------------------}
  569. bpf_in1:      
  570.     i4=dc1;                { point to coefficients              }
  571.     mr=0, mx0=dm(i1,m1), my0=pm(i4,m5);
  572.     cntr=31;            { length - 1                         }
  573.     do sopbp1 until ce;
  574. sopbp1:    mr=mr+mx0*my0(ss), mx0=dm(i1,m1), my0=pm(i4,m5);
  575.     mr=mr+mx0*my0(rnd);
  576.     if mv sat mr;
  577.     dm(bpf_out)=mr1;        { save input BPF result              }
  578.     rts;
  579.  
  580. {----------------------------------------------------------------------------}
  581. {            100 Baud Mark bandpass filter at 2125 Hz                     }
  582. {                       Fs=5512.5                                            }
  583. {              Fcl=2075,   Fch=2175  (BWpb=100)                             }
  584. {            Fstpl=1850, Fstph=2400  (BWsb=550)                         }
  585. {                                         }
  586. {              FINITE IMPULSE RESPONSE (FIR)                     }
  587. {            LINEAR PHASE DIGITAL FILTER DESIGN                     }
  588. {                REMEZ EXCHANGE ALGORITHM                     }
  589. {                                         }
  590. {                     BANDPASS FILTER                         }
  591. {                                         }
  592. { FILTER LENGTH =  54, however the algorithm will truncate the filter to     }
  593. { the same length as the 200 baud filter.                     }
  594. {                                         }
  595. {              ***** IMPULSE RESPONSE *****                     }
  596. {         H( 1) =     -50.828 = H( 54)                              }
  597. {         H( 2) =     -50.360 = H( 53)                              }
  598. {         H( 3) =      64.410 = H( 52)                              }
  599. {         H( 4) =     -58.060 = H( 51)                              }
  600. {         H( 5) =      26.085 = H( 50)                              }
  601. {         H( 6) =        .257 = H( 49)                              }
  602. {         H( 7) =      17.374 = H( 48)                              }
  603. {         H( 8) =     -74.849 = H( 47)                              }
  604. {         H( 9) =     102.469 = H( 46)                              }
  605. {         H(10) =      -6.040 = H( 45)                              }
  606. {         H(11) =    -239.639 = H( 44)                              }
  607. {         H(12) =     516.173 = H( 43)                              }
  608. {         H(13) =    -588.654 = H( 42)                              }
  609. {         H(14) =     256.211 = H( 41)                              }
  610. {         H(15) =     456.089 = H( 40)                              }
  611. {         H(16) =   -1213.837 = H( 39)                              }
  612. {         H(17) =    1506.112 = H( 38)                              }
  613. {         H(18) =    -961.908 = H( 37)                              }
  614. {         H(19) =    -338.876 = H( 36)                              }
  615. {         H(20) =    1792.896 = H( 35)                              }
  616. {         H(21) =   -2549.883 = H( 34)                              }
  617. {         H(22) =    2018.073 = H( 33)                              }
  618. {         H(23) =    -288.953 = H( 32)                              }
  619. {         H(24) =   -1814.791 = H( 31)                              }
  620. {         H(25) =    3154.414 = H( 30)                              }
  621. {         H(26) =   -2931.318 = H( 29)                              }
  622. {         H(27) =    1185.978 = H( 28)                              }
  623. {                                                   }
  624. {                       BAND  1       BAND  2       BAND  3                  }
  625. { LOWER BAND EDGE      .0000000      .3764000      .4354000                  }
  626. { UPPER BAND EDGE      .3356000      .3946000      .5000000                  }
  627. { DESIRED VALUE        .0000000     1.0000000      .0000000                  }
  628. { WEIGHTING          10.0000000     1.0000000    10.0000000                  }
  629. { DEVIATION            .0043615      .0436148      .0043615                  }
  630. { DEVIATION IN DB   -47.2073200      .3708049   -47.2073200                  }
  631. {----------------------------------------------------------------------------}
  632.       0xFFCD00; { -50.827999 }
  633.       0xFFCE00; { -50.360001 }
  634.       0x004000; {  64.410004 }
  635.       0xFFC600; { -58.060001 }
  636.       0x001A00; {  26.084999 }
  637.       0x000000; {   0.257000 }
  638.       0x001100; {  17.374001 }
  639.       0xFFB500; { -74.848999 }
  640.       0x006600; { 102.469002 }
  641.       0xFFFA00; {  -6.040000 }
  642.       0xFF1000; {-239.639008 }
  643. {---- above 11 coefficients are not used ----}
  644. hc1_11: 0x020400; { 516.172974 }
  645.       0xFDB300; { -588.653992 }
  646.       0x010000; {  256.210999 }
  647.       0x01C800; {  456.088989 }
  648.       0xFB4200; {-1213.837036 }
  649.       0x05E200; { 1506.112061 }
  650.       0xFC3E00; { -961.908020 }
  651.       0xFEAD00; { -338.876007 }
  652.       0x070100; { 1792.895996 }
  653.       0xF60A00; {-2549.883057 }
  654.       0x07E200; { 2018.072998 }
  655.       0xFEDF00; { -288.953003 }
  656.       0xF8E900; {-1814.791016 }
  657.       0x0C5200; { 3154.414062 }
  658.       0xF48D00; {-2931.318115 }
  659.       0x04A200; { 1185.978027 }
  660.       0x04A200; { 1185.978027 }
  661.       0xF48D00; {-2931.318115 }
  662.       0x0C5200; { 3154.414062 }
  663.       0xF8E900; {-1814.791016 }
  664.       0xFEDF00; { -288.953003 }
  665.       0x07E200; { 2018.072998 }
  666.       0xF60A00; {-2549.883057 }
  667.       0x070100; { 1792.895996 }
  668.       0xFEAD00; { -338.876007 }
  669.       0xFC3E00; { -961.908020 }
  670.       0x05E200; { 1506.112061 }
  671.       0xFB4200; {-1213.837036 }
  672.       0x01C800; {  456.088989 }
  673.       0x010000; {  256.210999 }
  674.       0xFDB300; { -588.653992 }
  675.       0x020400; {  516.172974 }
  676.       0xFF1000; { -239.639008 }
  677.       0xFFFA00; {   -6.040000 }
  678.       0x006600; {  102.469002 }
  679.       0xFFB500; {  -74.848999 }
  680.       0x001100; {   17.374001 }
  681.       0x000000; {    0.257000 }
  682.       0x001A00; {   26.084999 }
  683.       0xFFC600; {  -58.060001 }
  684.       0x004000; {   64.410004 }
  685.       0xFFCE00; {  -50.360001 }
  686.       0xFFCD00; {  -50.827999 }
  687. {----------------------------------------------------------------------------}
  688. mark_filter1:                                     
  689.     i4=hc1_11;            { point to coefficients              }         
  690.     l2=32;                { This filter length -note truncated-}
  691.     mr=0, mx0=dm(i2,m1), my0=pm(i4,m5);                     
  692.     cntr=31;            { length - 1                         }                 
  693.     do sopm1 until ce;                             
  694. sopm1:    mr=mr+mx0*my0(ss), mx0=dm(i2,m1), my0=pm(i4,m5);             
  695.     mr=mr+mx0*my0(rnd);                             
  696.     if mv sat mr;
  697.     ar = abs mr1;            { envelope detection                 }
  698.     dm(mark_out)=ar;        { save mark result                   }             
  699.     rts;                                     
  700. {----------------------------------------------------------------------------}
  701. {            100 Baud Space bandpass filter at 2295 Hz                     }
  702. {                       Fs=5512.5                                            }
  703. {              Fcl=2245,   Fch=2345  (BWpb=100)                             }
  704. {            Fstpl=2020, Fstph=2570  (BWsb=550)                         }
  705. {                                         }
  706. {              FINITE IMPULSE RESPONSE (FIR)                     }
  707. {            LINEAR PHASE DIGITAL FILTER DESIGN                     }
  708. {                REMEZ EXCHANGE ALGORITHM                     }
  709. {                                         }
  710. {                     BANDPASS FILTER                         }
  711. {                                         }
  712. { FILTER LENGTH =  54, however the algorithm will truncate the filter to     }
  713. { the same length as the 200 baud filter.                     }
  714. {                                         }
  715. {              ***** IMPULSE RESPONSE *****                     }
  716. {         H( 1) =     -93.030 = H( 54)                              }
  717. {         H( 2) =      46.098 = H( 53)                              }
  718. {         H( 3) =     -25.463 = H( 52)                              }
  719. {         H( 4) =      -8.725 = H( 51)                              }
  720. {         H( 5) =      35.308 = H( 50)                              }
  721. {         H( 6) =     -33.737 = H( 49)                              }
  722. {         H( 7) =       1.010 = H( 48)                              }
  723. {         H( 8) =      37.589 = H( 47)                              }
  724. {         H( 9) =     -34.152 = H( 46)                              }
  725. {         H(10) =     -58.028 = H( 45)                              }
  726. {         H(11) =     250.826 = H( 44)                              }
  727. {         H(12) =    -493.509 = H( 43)                              }
  728. {         H(13) =     673.650 = H( 42)                              }
  729. {         H(14) =    -652.255 = H( 41)                              }
  730. {         H(15) =     328.284 = H( 40)                              }
  731. {         H(16) =     294.866 = H( 39)                              }
  732. {         H(17) =   -1073.991 = H( 38)                              }
  733. {         H(18) =    1748.364 = H( 37)                              }
  734. {         H(19) =   -2022.781 = H( 36)                              }
  735. {         H(20) =    1685.986 = H( 35)                              }
  736. {         H(21) =    -717.446 = H( 34)                              }
  737. {         H(22) =    -667.943 = H( 33)                              }
  738. {         H(23) =    2065.687 = H( 32)                              }
  739. {         H(24) =   -3011.409 = H( 31)                              }
  740. {         H(25) =    3149.152 = H( 30)                              }
  741. {         H(26) =   -2372.752 = H( 29)                              }
  742. {         H(27) =     880.908 = H( 28)                              }
  743. {                                                          }
  744. {                       BAND  1       BAND  2       BAND  3                  }
  745. { LOWER BAND EDGE      .0000000      .4073000      .4662000                  }
  746. { UPPER BAND EDGE      .3664000      .4254000      .5000000                  }
  747. { DESIRED VALUE        .0000000     1.0000000      .0000000                  }
  748. { WEIGHTING          10.0000000     1.0000000    10.0000000                  }
  749. { DEVIATION            .0041196      .0411962      .0041196                  }
  750. { DEVIATION IN DB   -47.7028500      .3506519   -47.7028500                  }
  751. {----------------------------------------------------------------------------}
  752.       0xFFA300; {  -93.029999 }
  753.       0x002E00; {   46.098000 }
  754.       0xFFE700; {  -25.462999 }
  755.       0xFFF700; {   -8.725000 }
  756.       0x002300; {   35.307999 }
  757.       0xFFDE00; {  -33.737000 }
  758.       0x000100; {    1.010000 }
  759.       0x002600; {   37.589001 }
  760.       0xFFDE00; {  -34.152000 }
  761.       0xFFC600; {  -58.028000 }
  762.       0x00FB00; {  250.826004 }
  763. {---- above 11 coefficients are not used ----}
  764. jc1:  0xFE1200; { -493.509003 }
  765.       0x02A200; {  673.650024 }
  766.       0xFD7400; { -652.255005 }
  767.       0x014800; {  328.283997 }
  768.       0x012700; {  294.865997 }
  769.       0xFBCE00; {-1073.990967 }
  770.       0x06D400; { 1748.364014 }
  771.       0xF81900; {-2022.781006 }
  772.       0x069600; { 1685.985962 }
  773.       0xFD3300; { -717.445984 }
  774.       0xFD6400; { -667.942993 }
  775.       0x081200; { 2065.687012 }
  776.       0xF43D00; {-3011.408936 }
  777.       0x0C4D00; { 3149.152100 }
  778.       0xF6BB00; {-2372.751953 }
  779.       0x037100; {  880.908020 }
  780.       0x037100; {  880.908020 }
  781.       0xF6BB00; {-2372.751953 }
  782.       0x0C4D00; { 3149.152100 }
  783.       0xF43D00; {-3011.408936 }
  784.       0x081200; { 2065.687012 }
  785.       0xFD6400; { -667.942993 }
  786.       0xFD3300; { -717.445984 }
  787.       0x069600; { 1685.985962 }
  788.       0xF81900; {-2022.781006 }
  789.       0x06D400; { 1748.364014 }
  790.       0xFBCE00; {-1073.990967 }
  791.       0x012700; {  294.865997 }
  792.       0x014800; {  328.283997 }
  793.       0xFD7400; { -652.255005 }
  794.       0x02A200; {  673.650024 }
  795.       0xFE1200; { -493.509003 }
  796.       0x00FB00; {  250.826004 }
  797.       0xFFC600; {  -58.028000 }
  798.       0xFFDE00; {  -34.152000 }
  799.       0x002600; {   37.589001 }
  800.       0x000100; {    1.010000 }
  801.       0xFFDE00; {  -33.737000 }
  802.       0x002300; {   35.307999 }
  803.       0xFFF700; {   -8.725000 }
  804.       0xFFE700; {  -25.462999 }
  805.       0x002E00; {   46.098000 }
  806.       0xFFA300; {  -93.029999 }
  807. {----------------------------------------------------------------------------}
  808. space_filter1:                                     
  809.     i4=jc1;                { point to coefficients              }         
  810.     l2=32;                { This filter length                 }
  811.     mr=0, mx0=dm(i2,m1), my0=pm(i4,m5);                     
  812.     cntr=31;            { length - 1                         }                 
  813.     do sops1 until ce;                             
  814. sops1:    mr=mr+mx0*my0(ss), mx0=dm(i2,m1), my0=pm(i4,m5);             
  815.     mr=mr+mx0*my0(rnd);                             
  816.     if mv sat mr;
  817.     ar = abs mr1;            { envelope detection                 }
  818.     dm(space_out)=ar;        { save space result                  }             
  819.     rts;                                     
  820. {----------------------------------------------------------------------------}
  821. {              Data output lowpass filter                         }
  822. {----------------------------------------------------------------------------}
  823. { Type of filter is LOW PASS FILTER                         }
  824. { Filter length is 31 samples                             }
  825. { Sampling frequency is     5512.500 Hz                         }
  826. { Filter cut-off frequency is      100.000 Hz                     }
  827. { Type of window function is KAISER-BESSEL WINDOW                 }
  828. { Attenuation parameter of window is 60.000 dB                     }
  829. { Coefficient word length is 16 bits                         }
  830. {                                         }
  831. { Filter coefficients:                                 }
  832. {                                         }
  833. {   i          h[i]        hqf[i]        hqi[i]                     }
  834. {                                         }
  835. {   0    0.00042848    0.00042725            14                     }
  836. {   1    0.00107848    0.00106812            35                     }
  837. {   2    0.00210083    0.00210571            69                     }
  838. {   3    0.00356985    0.00357056           117                     }
  839. {   4    0.00553730    0.00552368           181                     }
  840. {   5    0.00802108    0.00802612           263                     }
  841. {   6    0.01099609    0.01098633           360                     }
  842. {   7    0.01438892    0.01437378           471                     }
  843. {   8    0.01807746    0.01806641           592                     }
  844. {   9    0.02189613    0.02188110           717                     }
  845. {  10    0.02564664    0.02563477           840                     }
  846. {  11    0.02911341    0.02911377           954                     }
  847. {  12    0.03208216    0.03207397          1051                     }
  848. {  13    0.03435966    0.03436279          1126                     }
  849. {  14    0.03579227    0.03579712          1173                     }
  850. {  15    0.03628118    0.03628540          1189                     }
  851. {  16    0.03579227    0.03579712          1173                     }
  852. {  17    0.03435966    0.03436279          1126                     }
  853. {  18    0.03208216    0.03207397          1051                     }
  854. {  19    0.02911341    0.02911377           954                     }
  855. {  20    0.02564664    0.02563477           840                     }
  856. {  21    0.02189613    0.02188110           717                     }
  857. {  22    0.01807746    0.01806641           592                     }
  858. {  23    0.01438892    0.01437378           471                     }
  859. {  24    0.01099609    0.01098633           360                     }
  860. {  25    0.00802108    0.00802612           263                     }
  861. {  26    0.00553730    0.00552368           181                     }
  862. {  27    0.00356985    0.00357056           117                     }
  863. {  28    0.00210083    0.00210571            69                     }
  864. {  29    0.00107848    0.00106812            35                     }
  865. {  30    0.00042848    0.00042725            14                     }
  866. {----------------------------------------------------------------------------}
  867. kc1:    0x000E00; {   14.000000 }                         
  868.     0x002300; {   35.000000 }                         
  869.     0x004500; {   69.000000 }                         
  870.     0x007500; {  117.000000 }                     
  871.     0x00B500; {  181.000000 }
  872.     0x010700; {  263.000000 }
  873.     0x016800; {  360.000000 }
  874.     0x01D700; {  471.000000 }
  875.     0x025000; {  592.000000 }
  876.     0x02CD00; {  717.000000 }
  877.     0x034800; {  840.000000 }
  878.     0x03BA00; {  954.000000 }
  879.     0x041B00; { 1051.000000 }
  880.     0x046600; { 1126.000000 }
  881.     0x049500; { 1173.000000 }
  882.     0x04A500; { 1189.000000 }
  883.     0x049500; { 1173.000000 }
  884.     0x046600; { 1126.000000 }
  885.     0x041B00; { 1051.000000 }
  886.     0x03BA00; {  954.000000 }
  887.     0x034800; {  840.000000 }
  888.     0x02CD00; {  717.000000 }
  889.     0x025000; {  592.000000 }
  890.     0x01D700; {  471.000000 }
  891.     0x016800; {  360.000000 }
  892.     0x010700; {  263.000000 }
  893.     0x00B500; {  181.000000 }
  894.     0x007500; {  117.000000 }
  895.     0x004500; {   69.000000 }
  896.     0x002300; {   35.000000 }
  897.     0x000E00; {   14.000000 }
  898. {----------------------------------------------------------------------------}
  899. data_lp1:      
  900.     i4=kc1;                { point to coefficients              }
  901.     mr=0, mx0=dm(i3,m1), my0=pm(i4,m5);
  902.     cntr=30;            { length - 1                         }
  903.     do sopd2_1 until ce;
  904. sopd2_1:    
  905.      mr=mr+mx0*my0(ss), mx0=dm(i3,m1), my0=pm(i4,m5);
  906.     mr=mr+mx0*my0(rnd);
  907.     if mv sat mr;
  908.     dm(data_out)=mr1;        { save result                        }
  909.     rts;
  910.  
  911. {-------------------------- AFSK modulator ----------------------------------}
  912. afsk:
  913.     ena M_MODE;
  914.     
  915.          ar = 1;
  916.          dm(mps)=ar;       { Restore sine and cosine quadrant multipliers       }
  917.     ar = dm(tph);
  918.  
  919. tones:     
  920.     dm(wkph)=ar;        { store a working copy                       }
  921.     si=ar;
  922.     sr = lshift si by -12 HI;    
  923.  
  924.     ay0=1;
  925.     ar=sr1-ay0;        { subtract 1 from high word                  }
  926.          if lt jump getem;      { is it in a quadrant bigger than first?     }
  927.  
  928.                     { yes its quadrant 2/3/4                     }
  929.     ar=ar-ay0;        { subtract 1 from high word                  }
  930.  
  931.     if ge jump thfr;     { is it in a quadrant greater than 2?        }
  932.  
  933.     ax0=0x2000;        { no, so load PI                             }
  934.     ay0=dm(wkph);
  935.     ar=ax0 - ay0;        { subtract phase so that it maps back to 1st }
  936.     dm(wkph)=ar;        { store                                      }
  937.          jump getem;        { go read tables                             }
  938.  
  939. thfr:     ar= -1;            { -1 multiplier for bottom half                 }
  940.          dm(mps)=ar;          { store                                         }
  941.  
  942.     ay0=0x2000;        { map angle back to upper half               }
  943.     ar=dm(wkph);
  944.     ar=ar - ay0;
  945.          jump tones;            { and do it again                            }
  946.  
  947. {---------------------- Table lookup ----------------------------------------}
  948. getem:     
  949.     si=dm(wkph);          { take 1st quadrant equiv for sine and     }
  950.     sr = lshift si by -6 HI;  { extract coarse part of phase address     }    
  951.  
  952.     i5 = sines;         { compute coarse value for index register    }
  953.     ar=i5;
  954.     ay0=sr1;
  955.     ar=ar+ay0;
  956.     i5=ar;
  957.     ar=pm(i5,m5);        { read the value                             }
  958.  
  959.     my1=dm(mps);        { multiply by sign                           }
  960.     mr=ar*my1(ss);
  961.     dm(sinx)=mr0;        { save result                                }
  962.  
  963. {------------------ Update cumulative phase angle ---------------------------}
  964. {                  When data_bit 0000 ==> no afsk being generated            }
  965. {                                 0001==> mark                               }
  966. {                                 0002==> space                              }
  967. {----------------------------------------------------------------------------}
  968.     ay0=0x0001;        { MARK?                                      }
  969.     ax0=dm(databit);
  970.     ar=ax0 xor ay0;
  971.     if eq jump set_mark;
  972.                  
  973.     ay0=6821;        {  Space = (2295/5512.5)/2*32768  = 6821     }
  974.     jump tone_out;
  975.  
  976. set_mark:
  977.     ay0=6316;        {  Mark  = (2125/5512.5)/2*32768  = 6316     }
  978.  
  979. tone_out:
  980.     si=dm(sinx);
  981.     sr = ashift si by -4 HI; { scale signal level for output             }    
  982.     dm(sigout)=sr1;
  983.     
  984.     ar=dm(tph);         { update phase accumulator                   }
  985.     ar=ar+ay0;
  986.     ay0=0x3FFF;
  987.     ar=ar and ay0;
  988.     dm(tph)=ar;
  989.  
  990. afsk_fin:
  991.     dis M_MODE;
  992.     rts;
  993. {---------------- Sine table in steps of PI/64 radians to PI/2---------------}
  994. sines:    0x000000; {     0.000000 }
  995.     0x032400; {   804.000000 }
  996.     0x064700; {  1607.000000 }
  997.     0x096A00; {  2410.000000 }
  998.     0x0C8B00; {  3211.000000 }
  999.     0x0FAB00; {  4011.000000 }
  1000.     0x12C700; {  4807.000000 }
  1001.     0x15E100; {  5601.000000 }
  1002.     0x18F800; {  6392.000000 }
  1003.     0x1C0B00; {  7179.000000 }
  1004.     0x1F1900; {  7961.000000 }
  1005.     0x222300; {  8739.000000 }
  1006.     0x252700; {  9511.000000 }
  1007.     0x282600; { 10278.000000 }
  1008.     0x2B1E00; { 11038.000000 }
  1009.     0x2E1000; { 11792.000000 }
  1010.     0x30FB00; { 12539.000000 }
  1011.     0x33DE00; { 13278.000000 }
  1012.     0x36B900; { 14009.000000 }
  1013.     0x398C00; { 14732.000000 }
  1014.     0x3C5600; { 15446.000000 }
  1015.     0x3F1600; { 16150.000000 }
  1016.     0x41CD00; { 16845.000000 }
  1017.     0x447A00; { 17530.000000 }
  1018.     0x471C00; { 18204.000000 }
  1019.     0x49B300; { 18867.000000 }
  1020.     0x4C3F00; { 19519.000000 }
  1021.     0x4EBF00; { 20159.000000 }
  1022.     0x513300; { 20787.000000 }
  1023.     0x539A00; { 21402.000000 }
  1024.     0x55F400; { 22004.000000 }
  1025.     0x584200; { 22594.000000 }
  1026.     0x5A8100; { 23169.000000 }
  1027.     0x5CB300; { 23731.000000 }
  1028.     0x5ED600; { 24278.000000 }
  1029.     0x60EB00; { 24811.000000 }
  1030.     0x62F100; { 25329.000000 }
  1031.     0x64E700; { 25831.000000 }
  1032.     0x66CE00; { 26318.000000 }
  1033.     0x68A500; { 26789.000000 }
  1034.     0x6A6C00; { 27244.000000 }
  1035.     0x6C2300; { 27683.000000 }
  1036.     0x6DC900; { 28105.000000 }
  1037.     0x6F5E00; { 28510.000000 }
  1038.     0x70E100; { 28897.000000 }
  1039.     0x725400; { 29268.000000 }
  1040.     0x73B500; { 29621.000000 }
  1041.     0x750300; { 29955.000000 }
  1042.     0x764000; { 30272.000000 }
  1043.     0x776B00; { 30571.000000 }
  1044.     0x788300; { 30851.000000 }
  1045.     0x798900; { 31113.000000 }
  1046.     0x7A7C00; { 31356.000000 }
  1047.     0x7B5C00; { 31580.000000 }
  1048.     0x7C2900; { 31785.000000 }
  1049.     0x7CE200; { 31970.000000 }
  1050.     0x7D8900; { 32137.000000 }
  1051.     0x7E1C00; { 32284.000000 }
  1052.     0x7E9C00; { 32412.000000 }
  1053.     0x7F0800; { 32520.000000 }
  1054.     0x7F6100; { 32609.000000 }
  1055.     0x7FA600; { 32678.000000 }
  1056.     0x7FD700; { 32727.000000 }
  1057.     0x7FF500; { 32757.000000 }
  1058.     0x7FFF00; { 32767.000000  PI/2 }
  1059.  
  1060.     nop;                        { Just for good measure      }
  1061.     nop;
  1062. {========================= END OF USER'S DSP CODE ===========================}
  1063.